﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ConvergenceTheme.Master" Inherits="System.Web.Mvc.ViewPage<elfam.web.Paging.PagingResult<elfam.web.Models.Order>>" %>
<%@ Import Namespace="elfam.web.Extensions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Заказы
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Заказы</h2>

    <table class="box-table-a">
        <tr>
            <th></th>
            <th>Пользователь</th>
            <th>Дата</th>
            <th>Сумма</th>
            <th>Доход</th>
            <th>Способ оплаты</th>
            <th>Способ доставки</th>
            <th>Город</th>
            <th>Статус</th>
            <%--<th></th>--%>
        </tr>

    <% foreach (var item in Model.Records) { %>
    
        <tr>
            <td><a href="/Order/Details/<%= item.Uid %>">...</a></td>
            <td><%= item.User.Email %></td>
            <td><%= item.Date.ToString("d") %></td>
            <td><%= item.SummWithDiscount().ToString("C0") %></td>
            <td><%= item.Profit().ToString("C0") %></td>
            <td><%= item.PaymentType.Description(item.PaymentType)%></td>
            <td><%= item.DeliverType.Description(item.DeliverType) %></td>
            <td><%= item.ShippingDetails.City %></td>
            <td><%= item.Status.Description(item.Status) %></td>
            <%-- <td>
                <form action="/Order/Revert" method="post">
                    <input name="id" type="hidden" value="<%= item.Id %>"/>
                    <input type="submit" value="откатить"/>
                </form>
            </td>--%>
        </tr>
    
    <% } %>

    </table>
    <div class="pager">
        <% if (this.Request.Params["user"] != null) {%>
            <%= Html.PageLinks(Model.PagingInfo, i => Url.Action("List", new { page = i, user = Request.Params["user"] }))%>
        <%} else {%>
            <%= Html.PageLinks(Model.PagingInfo, i => Url.Action("List", new { page = i }))%>
        <% } %>    
    </div>
</asp:Content>

